#pragma once

#include <QObject>
#include <QVector>
#include <QWidget>
#include <QMap>
#include <QStack>

class PageRelevancy : public QObject
{
	Q_OBJECT
public:
	static PageRelevancy* getInstance();
	void setFocus(QWidget* widget);
	QWidget* focus();
	void insertRelevancy(QWidget* parent, QWidget* child);
	QWidget* getRelevancyByParent(QWidget* parent);
	QWidget* getRelevancyByChild(QWidget* child);
	void insertParent(QWidget* parent, QWidget* child);
	QWidget* getParent(QWidget* child);
	QWidget* getChild(QWidget* parent);
protected:
	bool event(QEvent* event) override;
private:
	PageRelevancy();
	QMap<QWidget*, QWidget*> m_relevancyMap;
	QMap<QWidget*, QWidget*> m_parentMap;
	QWidget* m_focusWidget{nullptr};
};

